<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery("#ans-form").validationEngine();
	});
	
	var err		=	'<?php echo $error;?>';
	var inform	=	'<?php echo $inform;?>';
	if(err == 'true'){
		alert('Please type valid verification number.');
	}
	if(inform == 'true'){
		alert('Submit successfully! Thanks for your answer.');
	}
</script>
<div id="inner">
        <div class="wrap">
            <div id="main">
                <div id="content" class="answer entry">
                    <h1 class="entry-title">Questions & Answers</h1>
                    <div id="question-serch" class="clearfix">
                        <form class="search-question" action="<?php echo base_url();?>search" method="post">
                            <input type="text" name="question" class="s" value="Search your question..." onfocus="if (this.value == 'Search your question...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search your question...';}" />
                            <input type="submit" class="s-submit submit" value="Search">
                        </form>

                        <span>or</span>
                        <a href="<?php echo base_url();?>questions-and-answers/#make-question" class="make-question submit">Ask your question</a>
                    </div><!-- end #question-search -->

                    <div class="answer question entry-content">
                    	<?php if($question) {?>
                    	<?php if(count($question)>0 && count($answers)>0){?>
                        <h3>
                            <span>Question: </span>
                            <a href="<?php echo base_url().'answer/'.$question['brief_ascii']; ?>"><?php echo $question['brief'];?></a>
                        </h3>
                        <p><?php echo $question['detail']; ?></p>
                        <p style="color:#888;">Asked by <span style="color: green; font-weight: bold;"><?php echo $question['sender'];?></span>, <?php echo get_num_time($question['time']);?></p>
                        <p class="answer-session">Answer</p>
                        <p>Dear <?php echo $question['sender'].',';?></p>
                        <p><?php echo $answers['answer']?></p>
                        <p style="color:#888;">Answered by <span style="color: green; font-weight: bold;"><?php echo $answers['sender'];?></span>, <?php echo get_num_time($answers['time']);?></p>
						<?php }?>
						<?php }?>
						
						<div id="make-question" class="make-answer">
	                   		<a name="make-question"></a><br>
	                        <p class="your-question">Submit your answer</p>
	                        <form class="submit-question-form" action="<?php echo base_url();?>detail/<?php echo $quest_link;?>" method="post" id="ans-form">
	                        	<div class="qna" >
	                        		<div class="qna-name">
		                        		<label for="ans_name">Your name*</label><br>
		                        		<input type="text" class="validate[required]" name="ans_name" value="<?php echo set_value('ans_name');?>" id="ans-name" />
	                        		</div>
	                        		<div class="qna-email">
		                        		<label for="ans_email">Your email*</label>
		                        		<span class="tooltip" title="Your email will not be displayed "><img src="<?php echo img_link('icon_help.png', 'client');?>" title="" alt="" class="" id="email_display" /></span>
		                        		<br>
		                        		<input type="text" class="validate[required, custom[email]]" name="ans_email" value="<?php echo set_value('ans_email');?>" id="ans-email" />
	                        		</div>
	                        	</div>
	                            <div class="qna-detail">
	                                <label for="answer_detail">Your answer details*</label><br/>
	                                <textarea name="answer_detail" id="answer_detail" value="" class="validate[required]"><?php echo set_value('answer_detail');?></textarea>
	                            </div>
	                            <div class="qna-captcha">
	                            	<label for="vertication_num_ans">Verification Number* ( <font color='green'><?php if(isset($vertify_num)){echo $vertify_num;}?> </font>)</label><br>
	                            	<input type="text" name="vertication_num_ans" id="vertication_number_ans" value="" />
	                            </div>
	                            <div>
	                            	<input type="hidden" value="<?php if(isset($question['id'])){echo $question['id'];}?>" name="question_id_hidd" />
	                                <input type="submit" class="submit-question submit" value="Submit your answer" />
	                            </div>
	                        </form>
                   	 	</div>
                        <div class="related-questions related-faqs">
                            <p class="related-text">Other questions</p>
                            <?php if(count($others[0])>0){?>
	                            <ol>
	                            	<?php foreach ($others as $k => $v){?>
	                               		<li><a href="<?php echo base_url().'answer/'.$v->brief_ascii;?>"><?php echo $v->brief;?></a></li>
	                                <?php }?>
	                            </ol>
                            <?php }?>
                        </div>
                    </div><!-- end .question -->
                </div><!-- end #content -->
            </div><!-- end #main -->